package com.jxwifi.cloud.quickcleanserver.mycenter;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;

import com.basicactivity.BasicActivity;
import com.jxwifi.cloud.quickcleanserver.R;
import com.jxwifi.cloud.quickcleanserver.app.CleanBasicActivity;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 个人中心的用户协议
 * Created by Administrator on 2019/6/10.
 */

public class UserActivity extends CleanBasicActivity {
    @Bind(R.id.lucky_web)
    WebView mLuckWeb;
    private int agreementId;
    @Bind(R.id.agreementTitle)
    TextView agreementTitle;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_agreement);
        ButterKnife.bind(this);
        openEventBus();
        String sID=getIntent().getStringExtra("agreementId");
        if(null != sID){
            agreementId=Integer.parseInt(sID);
        }
        if(agreementId == 2){
            agreementTitle.setText("隐私政策");
            //暂无隐私政策网址，先用用户服务协议
            mLuckWeb.loadUrl("https://ui.qcleaner.cn/resource/cleaner.html");
        }else{
            //用户协议
            mLuckWeb.loadUrl("https://ui.qcleaner.cn/resource/client.html");
        }
        mLuckWeb.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return super.shouldOverrideUrlLoading(view, url);
            }

        });
    }

    @OnClick({R.id.rel_img_back_pressed})
    void clickCK(View v) {
        switch (v.getId()) {
            case R.id.rel_img_back_pressed:
                onBackPressed();
                break;
        }
    }
}
